home *** CD-ROM | disk | FTP | other *** search
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class TEST_DOUBLE1
-
- creation {ANY}
- make
-
- feature {ANY}
-
- make is
- local
- i: INTEGER;
- d, d2: DOUBLE;
- do
- d := 1.6;
- is_true(d = d);
- is_true(1.6 = d);
- is_true(d >= 1.59);
- is_true(d <= 1.61);
-
- d := 2;
- is_true(d = 2.0);
-
- i := 2;
- d := i;
- is_true(d = 2);
- is_true(d = 2.0);
-
- d := (1.51).to_string.to_double;
- is_true(d < 1.511);
- is_true(d > 1.509);
-
- d := (-1.51).to_string.to_double;
- is_true(d > -1.52);
- is_true(d < -1.50);
-
- is_true(d.abs < 1.52);
- is_true(d.abs > 1.50);
- is_true((-d).abs < 1.52);
- is_true((-d).abs > 1.50);
-
- d := 4.0;
- d2 := 2.0;
- is_true(d.sqrt = d2);
- end;
-
- is_true(b: BOOLEAN) is
- do
- cpt := cpt + 1;
- if not b then
- std_output.put_string("TEST_DOUBLE1: ERROR Test # ");
- std_output.put_integer(cpt);
- std_output.put_string("%N");
- else
- -- std_output.put_string("Yes%N");
- end;
- end;
-
- cpt: INTEGER;
-
- end -- TEST_DOUBLE1
-